<!DOCTYPE html>
<html  class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>登陆撒</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" th:href="@{/css/font.css}" href="../static/css/font.css">
    <link rel="stylesheet" th:href="@{/css/login.css}" href="../static/css/login.css">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}" href="../static/css/xadmin.css">

    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
<script type="text/javascript" th:src="@{/js/jquery.min.js}"  src="../static/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/lib/layui/layui.js}" src="../static/lib/layui/layui.js" charset="utf-8"></script>

    <div class="login layui-anim layui-anim-up">
        <div class="message">登录</div>
        <div id="darkbannerwrap"></div>
        <p th:if="${not #strings.isEmpty(msg)}" th:text="${msg}">
        <form class="layui-form" >
            <input name="token" id="token" placeholder="请输入密匙"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input value="登录"  style="width:100%;" type="button" onclick="_submit()">
            <hr class="hr20" >
        </form>
    </div>

    <script type="text/javascript">
        function _submit() {
            var xhr=new XMLHttpRequest();
            xhr.open('get','/user/check?token='+document.getElementById('token').value);
            xhr.send();
            xhr.onload=function (){
                console.log(xhr.responseText)
                if(JSON.parse(xhr.responseText)){
                    location.href='/index'
                }else {
                    layui.use("layer",function () {
                        var layer=layui.layer;
                        layer.msg('密匙错误');
                    })
                }

        }
        }

    </script>
</body>
</html>